< previous page page_269 next page >

Page 269
Examples Filename: Employee1.frm
EXERCISE
Create Commands for the Data Control
1. Set the Enabled property of the Save button to False.
2. Add a command button to the Employee Information form and place it next to the Save button.
3. Set the Name property to cmdDelete.
4. Set the Caption property to &Delete.
5. Add another command button and place it next to the Delete button.
6. Set the Name property to cmdNew.
7. Set the Caption property to &New.
8. You may need to shrink the size of all the command buttons to get them all to fit.
analysis.gifUsing command buttons is just one technique of allowing the user to interact with the Data Control. You could also use menus and/or toolbars.

Adding Records
Forcing the user to move to the end of the recordset just to add a new record is not a very good user interface technique. Therefore, lets program the New command button so that the user can add a new record at any time.
EXERCISE
Adding Code to the New Command Button
1. Double-click the New button to bring up a code window.
2. Add the following code to the Click event of the New button:
Private Sub cmdNew_Click()
datEmployees.Recordset.AddNew
txtFirst.SetFocus
End Sub

 
< previous page page_269 next page >

If you like this book, buy it!